﻿using System;

namespace jLight.Extensions
{
    //public class jQueryEvent
    //{

    //}
    public static class jQueryExtensionEvents
    {
        // public static jQueryEvent Event;
        //TODO:Change return types to match the Event type, which is returned by jQuery

        /// <summary>
        /// Attach a handler to an event for the elements.
        /// </summary>
        public static jQueryObject Bind(this jQueryObject value, string eventType, Func<object, object> function)
        {
            return value.Invoke("bind", eventType, jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Attach a handler to an event for the elements.
        /// </summary>
        public static jQueryObject Bind(this jQueryObject value, string eventType, string javascriptFunction)
        {
            return value.Invoke("bind", eventType, javascriptFunction);
        }
        /// <summary>
        /// Attach a handler to an event for the elements.
        /// </summary>
        public static jQueryObject Bind(this jQueryObject value, string eventType, string eventData, Func<object, object> function)
        {
            return value.Invoke("bind", eventType, eventData, jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Attach a handler to an event for the elements.
        /// </summary>
        public static jQueryObject Bind(this jQueryObject value, string eventType, string eventData, string javascriptFunction)
        {
            return value.Invoke("bind", eventType, eventData, javascriptFunction);
        }

        /// <summary>
        /// Bind an event handler to the "blur" JavaScript event.
        /// </summary>
        public static jQueryObject Blur(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("blur", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "blur" JavaScript event.
        /// </summary>
        public static jQueryObject Blur(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("blur", javascriptFunction);
        }
        /// <summary>
        /// Trigger 'blur' event on an element.
        /// </summary>
        public static jQueryObject Blur(this jQueryObject value)
        {
            return value.Invoke("blur");
        }

        /// <summary>
        /// Bind an event handler to the "change" JavaScript event.
        /// </summary>
        public static jQueryObject Change(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("change", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "change" JavaScript event.
        /// </summary>
        public static jQueryObject Change(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("change", javascriptFunction);
        }
        /// <summary>
        /// Trigger "change" event on an element.
        /// </summary>
        public static jQueryObject Change(this jQueryObject value)
        {
            return value.Invoke("change");
        }

        /// <summary>
        /// Bind an event handler to the "click" JavaScript event.
        /// </summary>
        public static jQueryObject Click(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("click", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "click" JavaScript event.
        /// </summary>
        public static jQueryObject Click(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("click", javascriptFunction);
        }
        /// <summary>
        /// Trigger Click event on an element.
        /// </summary>
        public static jQueryObject Click(this jQueryObject value)
        {
            return value.Invoke("click");
        }

        /// <summary>
        /// Bind an event handler to the "dblclick" JavaScript event.
        /// </summary>
        public static jQueryObject DblClick(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("dblclick", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "dblclick" JavaScript event.
        /// </summary>
        public static jQueryObject DblClick(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("dblclick", javascriptFunction);
        }
        /// <summary>
        /// Trigger dblclick event on an element.
        /// </summary>
        public static jQueryObject DblClick(this jQueryObject value)
        {
            return value.Invoke("dblclick");
        }

        /// <summary>
        /// Bind an event handler to the "error" JavaScript event.
        /// </summary>
        public static jQueryObject Error(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("error", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "error" JavaScript event.
        /// </summary>
        public static jQueryObject Error(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("error", javascriptFunction);
        }

        /// <summary>
        /// Bind an event handler to the "focus" JavaScript event.
        /// </summary>
        public static jQueryObject Focus(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("focus", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "focus" JavaScript event.
        /// </summary>
        public static jQueryObject Focus(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("focus", javascriptFunction);
        }
        /// <summary>
        /// Trigger focus event on an element.
        /// </summary>
        public static jQueryObject Focus(this jQueryObject value)
        {
            return value.Invoke("focus");
        }

        /// <summary>
        /// Bind an event handler to the "focusin" JavaScript event.
        /// </summary>
        public static jQueryObject FocusIn(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("focusin", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "focus" JavaScript event.
        /// </summary>
        public static jQueryObject FocusIn(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("focusin", javascriptFunction);
        }

        /// <summary>
        /// Bind an event handler to the "focusin" JavaScript event.
        /// </summary>
        public static jQueryObject FocusOut(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("focusout", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "focusout" JavaScript event.
        /// </summary>
        public static jQueryObject FocusOut(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("focusout", javascriptFunction);
        }

        /// <summary>
        /// Bind an event handler to the "hover" JavaScript event.
        /// </summary>
        public static jQueryObject Hover(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("hover", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "hover" JavaScript event.
        /// </summary>
        public static jQueryObject Hover(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("hover", javascriptFunction);
        }
        /// <summary>
        /// Bind an event handler to the "hover" JavaScript event.
        /// </summary>
        public static jQueryObject Hover(this jQueryObject value, Func<object, object> handlerIn, Func<object, object> handlerOut)
        {
            return value.Invoke("hover", jQueryFunction.CreateCallback1(handlerIn), jQueryFunction.CreateCallback1(handlerOut));
        }
        /// <summary>
        /// Bind an event handler to the "hover" JavaScript event.
        /// </summary>
        public static jQueryObject Hover(this jQueryObject value, string handlerIn, string handlerOut)
        {
            return value.Invoke("hover", handlerIn, handlerOut);
        }

        /// <summary>
        /// Bind an event handler to the "keydown" JavaScript event.
        /// </summary>
        public static jQueryObject KeyDown(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("keydown", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "keydown" JavaScript event.
        /// </summary>
        public static jQueryObject KeyDown(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("keydown", javascriptFunction);
        }
        /// <summary>
        /// Trigger keydown event on an element.
        /// </summary>
        public static jQueryObject KeyDown(this jQueryObject value)
        {
            return value.Invoke("keydown");
        }

        /// <summary>
        /// Bind an event handler to the "keypress" JavaScript event.
        /// </summary>
        public static jQueryObject KeyPress(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("keypress", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "keypress" JavaScript event.
        /// </summary>
        public static jQueryObject KeyPress(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("keypress", javascriptFunction);
        }
        /// <summary>
        /// Trigger keypress event on an element.
        /// </summary>
        public static jQueryObject KeyPress(this jQueryObject value)
        {
            return value.Invoke("keypress");
        }

        /// <summary>
        /// Bind an event handler to the "keyup" JavaScript event.
        /// </summary>
        public static jQueryObject KeyUp(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("keyup", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "keyup" JavaScript event.
        /// </summary>
        public static jQueryObject KeyUp(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("keyup", javascriptFunction);
        }
        /// <summary>
        /// Trigger keyup event on an element.
        /// </summary>
        public static jQueryObject KeyUp(this jQueryObject value)
        {
            return value.Invoke("keyup");
        }

        /// <summary>
        /// Remove an event handler previously attached using .live() from the elements.
        /// </summary>
        public static jQueryObject Die(this jQueryObject value, string eventType)
        {
            return value.Invoke("die", eventType);
        }
        /// <summary>
        /// Attach a handler to the event for all elements which match the current selector, now or in the future.
        /// </summary>
        public static jQueryObject Live(this jQueryObject value, string eventType, Func<object, object> function)
        {
            return value.Invoke("live", eventType, function);
        }
        /// <summary>
        /// Attach a handler to the event for all elements which match the current selector, now or in the future.
        /// </summary>
        public static jQueryObject Live(this jQueryObject value, string eventType, string function)
        {
            return value.Invoke("live", eventType, function);
        }

        /// <summary>
        /// Bind an event handler to the "load" JavaScript event.
        /// </summary>
        public static jQueryObject Load(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("load", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "load" JavaScript event.
        /// </summary>
        public static jQueryObject Load(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("load", javascriptFunction);
        }

        /// <summary>
        /// Bind an event handler to the "mousedown" JavaScript event.
        /// </summary>
        public static jQueryObject MouseDown(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("mousedown", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "mousedown" JavaScript event.
        /// </summary>
        public static jQueryObject MouseDown(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("mousedown", javascriptFunction);
        }
        /// <summary>
        /// Trigger mousedown event on an element.
        /// </summary>
        public static jQueryObject MouseDown(this jQueryObject value)
        {
            return value.Invoke("mousedown");
        }

        /// <summary>
        ///  Bind an event handler to be fired when the mouse enters an element.
        /// </summary>
        public static jQueryObject MouseEnter(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("mouseenter", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        ///  Bind an event handler to be fired when the mouse enters an element.
        /// </summary>
        public static jQueryObject MouseEnter(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("mouseenter", javascriptFunction);
        }
        /// <summary>
        /// Trigger mouseenter event on an element.
        /// </summary>
        public static jQueryObject MouseEnter(this jQueryObject value)
        {
            return value.Invoke("mouseenter");
        }

        /// <summary>
        ///  Bind an event handler to be fired when the mouse leaves an element.
        /// </summary>
        public static jQueryObject MouseLeave(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("mouseleave", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        ///  Bind an event handler to be fired when the mouse leaves an element.
        /// </summary>
        public static jQueryObject MouseLeave(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("mouseleave", javascriptFunction);
        }
        /// <summary>
        /// Trigger mouseleave event on an element.
        /// </summary>
        public static jQueryObject MouseLeave(this jQueryObject value)
        {
            return value.Invoke("mouseleave");
        }

        /// <summary>
        /// Bind an event handler to the "mousemove" JavaScript event.
        /// </summary>
        public static jQueryObject MouseMove(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("mousemove", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "mouseenter" JavaScript event.
        /// </summary>
        public static jQueryObject MouseMove(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("mousemove", javascriptFunction);
        }
        /// <summary>
        /// Trigger mousemove event on an element.
        /// </summary>
        public static jQueryObject MouseMove(this jQueryObject value)
        {
            return value.Invoke("mousemove");
        }

        /// <summary>
        /// Bind an event handler to the "mouseout" JavaScript event.
        /// </summary>
        public static jQueryObject MouseOut(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("mouseout", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "mouseenter" JavaScript event.
        /// </summary>
        public static jQueryObject MouseOut(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("mouseout", javascriptFunction);
        }
        /// <summary>
        /// Trigger mouseout event on an element.
        /// </summary>
        public static jQueryObject MouseOut(this jQueryObject value)
        {
            return value.Invoke("mouseout");
        }

        /// <summary>
        /// Bind an event handler to the "mouseover" JavaScript event.
        /// </summary>
        public static jQueryObject MouseOver(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("mouseover", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "mouseover" JavaScript event.
        /// </summary>
        public static jQueryObject MouseOver(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("mouseover", javascriptFunction);
        }
        /// <summary>
        /// Trigger mouseover event on an element.
        /// </summary>
        public static jQueryObject MouseOver(this jQueryObject value)
        {
            return value.Invoke("mouseover");
        }

        /// <summary>
        /// Bind an event handler to the "mouseup" JavaScript event.
        /// </summary>
        public static jQueryObject MouseUp(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("mouseup", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "mouseup" JavaScript event.
        /// </summary>
        public static jQueryObject MouseUp(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("mouseup", javascriptFunction);
        }
        /// <summary>
        /// Trigger mouseup event on an element.
        /// </summary>
        public static jQueryObject MouseUp(this jQueryObject value)
        {
            return value.Invoke("mouseup");
        }

        /// <summary>
        /// Attach a handler to an event for the elements. The handler is executed at most once.
        /// </summary>
        public static jQueryObject One(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("one", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Attach a handler to an event for the elements. The handler is executed at most once.
        /// </summary>
        public static jQueryObject One(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("one", javascriptFunction);
        }

        /// <summary>
        /// Specify a function to execute when the DOM is fully loaded.
        /// </summary>
        public static jQueryObject Ready(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("ready", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Specify a function to execute when the DOM is fully loaded.
        /// </summary>
        public static jQueryObject Ready(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("ready", javascriptFunction);
        }

        /// <summary>
        /// Bind an event handler to the "resize" JavaScript event.
        /// </summary>
        public static jQueryObject Resize(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("resize", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "resize" JavaScript event.
        /// </summary>
        public static jQueryObject Resize(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("resize", javascriptFunction);
        }
        /// <summary>
        /// Trigger resize event on an element.
        /// </summary>
        public static jQueryObject Resize(this jQueryObject value)
        {
            return value.Invoke("resize");
        }

        /// <summary>
        /// Bind an event handler to the "scroll" JavaScript event.
        /// </summary>
        public static jQueryObject Scroll(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("scroll", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "scroll" JavaScript event.
        /// </summary>
        public static jQueryObject Scroll(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("scroll", javascriptFunction);
        }
        /// <summary>
        /// Trigger scroll event on an element.
        /// </summary>
        public static jQueryObject Scroll(this jQueryObject value)
        {
            return value.Invoke("scroll");
        }

        /// <summary>
        /// Bind an event handler to the "select" JavaScript event.
        /// </summary>
        public static jQueryObject Select(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("select", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "select" JavaScript event.
        /// </summary>
        public static jQueryObject Select(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("select", javascriptFunction);
        }
        /// <summary>
        /// Trigger select event on an element.
        /// </summary>
        public static jQueryObject Select(this jQueryObject value, object javascriptFunction)
        {
            return value.Invoke("select");
        }

        /// <summary>
        /// Bind an event handler to the "submit" JavaScript event.
        /// </summary>
        public static jQueryObject Submit(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("submit", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "submit" JavaScript event.
        /// </summary>
        public static jQueryObject Submit(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("submit", javascriptFunction);
        }
        /// <summary>
        /// Trigger submit event on an element.
        /// </summary>
        public static jQueryObject Submit(this jQueryObject value)
        {
            return value.Invoke("submit");
        }

        /// <summary>
        /// Bind two handlers to the matched elements, to be executed on alternate clicks.
        /// </summary>
        public static jQueryObject Toggle(this jQueryObject value, Func<object, object> function1, Func<object, object> function2)
        {
            return value.Invoke("toggle", jQueryFunction.CreateCallback1(function1), jQueryFunction.CreateCallback1(function2));
        }
        /// <summary>
        /// Bind two handlers to the matched elements, to be executed on alternate clicks.
        /// </summary>
        public static jQueryObject Toggle(this jQueryObject value, string javascriptFunction1, string javascriptFunction2)
        {
            return value.Invoke("toggle", javascriptFunction1, javascriptFunction2);
        }
        /// <summary>
        /// Bind Three handlers to the matched elements, to be executed on alternate clicks.
        /// </summary>
        public static jQueryObject Toggle(this jQueryObject value, Func<object, object> function1, Func<object, object> function2, Func<object, object> function3)
        {
            return value.Invoke("toggle", jQueryFunction.CreateCallback1(function1), jQueryFunction.CreateCallback1(function2), jQueryFunction.CreateCallback1(function3));
        }
        /// <summary>
        /// Bind three handlers to the matched elements, to be executed on alternate clicks.
        /// </summary>
        public static jQueryObject Toggle(this jQueryObject value, string javascriptFunction1, string javascriptFunction2, string javascriptFunction3)
        {
            return value.Invoke("toggle", javascriptFunction1, javascriptFunction2, javascriptFunction3);
        }
        /// <summary>
        /// Display or hide the matched elements.
        /// </summary>       
        /// <param name="duration">A string determining how long the animation will run.</param>
        /// <param name="function">A function to call once the animation is complete.</param>        
        public static jQueryObject Toggle(this jQueryObject value, string duration, Func<object, object> function)
        {
            return value.Invoke("toggle", duration, jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Display or hide the matched elements.
        /// </summary>       
        /// <param name="duration">A number determining how long the animation will run.</param>
        /// <param name="function">A function to call once the animation is complete.</param>        
        public static jQueryObject Toggle(this jQueryObject value, double duration, Func<object, object> function)
        {
            return value.Invoke("toggle", duration, jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Display or hide the matched elements.
        /// </summary>       
        /// <param name="duration">A number determining how long the animation will run.</param>
        /// <param name="function">A function to call once the animation is complete.</param>        
        public static jQueryObject Toggle(this jQueryObject value, double duration, string function)
        {
            return value.Invoke("toggle", duration, function);
        }
        /// <summary>
        /// Display or hide the matched elements.
        /// </summary>       
        /// <param name="showHide">A Boolean indicating whether to show or hide the elements.
        ///</param>        
        public static jQueryObject Toggle(this jQueryObject value, bool showHide)
        {
            return value.Invoke("toggle", showHide);
        }

        /// <summary>
        /// Execute all handlers and behaviors attached to the matched elements for the given event type.
        /// </summary>       
        public static jQueryObject Trigger(this jQueryObject value, string eventType)
        {
            return value.Invoke("trigger", eventType);
        }
        /// <summary>
        /// Execute all handlers and behaviors attached to the matched elements for the given event type.
        /// </summary>       
        public static jQueryObject Trigger(this jQueryObject value, string eventType, params string[] extraParameters)
        {
            return value.Invoke("trigger", eventType, extraParameters);
        }
 
        /// <summary>
        /// Execute all handlers attached to an element for an event.
        /// </summary>       
        public static jQueryObject TriggerHandler(this jQueryObject value, string eventType)
        {
            return value.Invoke("triggerHandler", eventType);
        }
        /// <summary>
        /// Execute all handlers attached to an element for an event.
        /// </summary>       
        public static jQueryObject TriggerHandler(this jQueryObject value, string eventType, params string[] extraParameters)
        {
            return value.Invoke("triggerHandler", eventType, extraParameters);
        }

        /// <summary>
        /// Remove a previously-attached event handler from the elements.
        /// </summary>
        public static jQueryObject Unbind(this jQueryObject value, string eventType)
        {
            return value.Invoke("unbind", eventType);
        }

        /// <summary>
        /// Bind an event handler to the "unload" JavaScript event.
        /// </summary>
        public static jQueryObject Unload(this jQueryObject value, Func<object, object> function)
        {
            return value.Invoke("unload", jQueryFunction.CreateCallback1(function));
        }
        /// <summary>
        /// Bind an event handler to the "unload" JavaScript event.
        /// </summary>
        public static jQueryObject Unload(this jQueryObject value, string javascriptFunction)
        {
            return value.Invoke("unload", javascriptFunction);
        }


    }
}